
public class NeighbouringNumbers
{
	public static void main( String[] args )
	{
		
		int inputNumber;
		int arrayLength = args.length;
		
		if (arrayLength < 2) 
		{
			System.out.println("Type more numbers!");
			return;
		}
		
		int[] numbers = new int[arrayLength];
		
		//fill array
		for (int i = 0; i < arrayLength; i++)
		{
			try
			{
				numbers[i] = Integer.parseInt(args[i]);
			}
			catch(Exception e)
			{
				System.out.println("Error parsing " + i + "th element");
				return;
			}
		}
		
		//find distance
		int minDistance = Math.abs( numbers[1] - numbers[0] );
		int index = 0;
		
		for (int i = 1; i < arrayLength - 1; i++)
		{
			int distance = Math.abs( numbers[i+1] - numbers[i] ) ;
			
			if ( minDistance > distance ) 
			{
				minDistance = distance;
				index = i;
			}	
		}
		
		System.out.println( index );
	}
}